package com.zxe.controller;

import com.zxe.feign.UserFeignService;
import com.zxe.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zxe.dto.OrderDTO;
import com.zxe.dto.UserDTO;
import com.zxe.service.OrderService;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/{id}")
    public Result<OrderDTO> getInfo(@PathVariable Integer id){
        return new Result<OrderDTO>().ok(orderService.getById(id));
    }

    @GetMapping("getAll")
    public Result<List<UserDTO>> getAll(){
        return new Result<List<UserDTO>>().ok(orderService.getAll());
    }
}
